home *** CD-ROM | disk | FTP | other *** search
- rem fitting a function with 2 peaks with 2 Gaussians:
- calc x = {-10,10,0.1}
- calc y = 15*G((x-1.1)/1.2)+11*G((x+2.2)/0.8)+3.3+0.5*sin(10*x)
- calc y "Original function y ->" "x ->"
- calc coef = Fitc(y,G(14,1,1)+G(10,-2,1)+3)
- rem compare the above best fit coefficients and the original expression for y:
- rem original y = 15*G((x-1.1)/1.2)+11*G((x+2.2)/0.8)+3.3+sin(3*x)
- @pause
- calc fitted(coef,x) "Best Fit ->" "x ->"
- @if errorlevel 1 goto fin
- @pause
- rem fitted(coef,x) is a best fitted function:
- calc max(fitted(coef,x)-y)
- rem these are fitting coefficients:
- rem A - amplitude, X - position, W - width of the n-th peak.
- rem Co - constant term.
- @echo off
- calc An(coef,1)
- calc Xn(coef,1)
- calc Wn(coef,1)
- calc An(coef,2)
- calc Xn(coef,2)
- calc Wn(coef,2)
- calc Co(coef)
- : fin